﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Account/Site.master" AutoEventWireup="true" CodeFile="HinhAnh.aspx.cs" Inherits="Administrator_HinhAnh" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <div>
    <asp:SiteMapPath ID="SiteMapPath1" runat="server" Font-Names="Verdana" 
        Font-Size="0.8em" PathSeparator=" : " style="font-size: small">
        <CurrentNodeStyle ForeColor="#333333" />
        <NodeStyle Font-Bold="True" ForeColor="#284E98" />
        <PathSeparatorStyle Font-Bold="True" ForeColor="#507CD1" />
        <RootNodeStyle Font-Bold="True" ForeColor="#507CD1" />
    </asp:SiteMapPath>
    <br />
    <asp:Label ID="Label1" runat="server" 
        style="font-size: x-large; font-weight: 700" Text="Quản lý hình ảnh sản phẩm"></asp:Label>
        <br />
        <br />
        <br />
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
            DataKeyNames="ID" DataSourceID="SqlDataSource1" EnableModelValidation="True" 
            Width="100%">
            <Columns>
                <asp:CommandField ShowDeleteButton="True">
                <ItemStyle Width="10px" />
                </asp:CommandField>
                <asp:ImageField DataImageUrlField="URL" HeaderText="Hình Ảnh">
                    <ControlStyle Height="82px" Width="220px" />
                    <ItemStyle Height="82px" Width="160px" />
                </asp:ImageField>
                <asp:BoundField DataField="URL" HeaderText="URL" SortExpression="URL" />
            </Columns>
            <EmptyDataTemplate>
                Chưa có hình ảnh nào (Click Tải ảnh)
            </EmptyDataTemplate>
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <RowStyle ForeColor="#000066" />
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectServer %>" 
            DeleteCommand="DELETE FROM [HinhAnh] WHERE [ID] = @ID" 
            InsertCommand="INSERT INTO [HinhAnh] ([URL]) VALUES (@URL)" 
            SelectCommand="SELECT [URL], [ID] FROM [HinhAnh] WHERE ([MaSanPham] = @MaSanPham)" 
            UpdateCommand="UPDATE [HinhAnh] SET [URL] = @URL WHERE [ID] = @ID">
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="URL" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:QueryStringParameter Name="MaSanPham" QueryStringField="ID" 
                    Type="String" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="URL" Type="String" />
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    &nbsp;<asp:Label ID="Label2" runat="server" Text="Cỡ ảnh  W : 220px H : 220 px"></asp:Label>
&nbsp;<asp:FileUpload ID="FileUpload1" runat="server" />
&nbsp;&nbsp;
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
            Text="Tải ảnh" />
        <br />
        <asp:Label ID="Label3" runat="server" style="font-style: italic" 
            Text="Dung lượng ảnh không quá 2Mb"></asp:Label>
        <br />
        <br />
        <asp:LinkButton ID="LinkButton1" runat="server" 
            PostBackUrl="~/Administrator/SanPham.aspx">Quay về danh sách sản phẩm</asp:LinkButton>
        <br />
    <br />
    </div>
</asp:Content>

